package leetcode;

/**
 * @author zhangjunfei
 * @date 2023/7/20 17:19
 */
public class L_1464 {
    public int maxProduct(int[] nums) {
        int a = nums[0], b = nums[1];
        if (a < b) {
            a=nums[1];
            b = nums[0];
        }
        for (int i = 2; i < nums.length; i++) {
            if (nums[i] > b) {
                b = nums[i];
            }
            if (nums[i] > a) {
                b = a;
                a = nums[i];
            }
        }
        return (a - 1) * (b - 1);
    }
}
